\(\int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx\) [465]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 57 \[ \int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx=-\frac {\sqrt {a \cos ^2(e+f x)} \csc (e+f x) \sec (e+f x)}{f}-\frac {\sqrt {a \cos ^2(e+f x)} \tan (e+f x)}{f} \]

[Out]

-csc(f*x+e)*sec(f*x+e)*(a*cos(f*x+e)^2)^(1/2)/f-(a*cos(f*x+e)^2)^(1/2)*tan(f*x+e)/f

Rubi [A] (verified)

Time = 0.15 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3255, 3286, 2670, 14} \[ \int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx=-\frac {\tan (e+f x) \sqrt {a \cos ^2(e+f x)}}{f}-\frac {\csc (e+f x) \sec (e+f x) \sqrt {a \cos ^2(e+f x)}}{f} \]

[In]

Int[Cot[e + f*x]^2*Sqrt[a - a*Sin[e + f*x]^2],x]

[Out]

-((Sqrt[a*Cos[e + f*x]^2]*Csc[e + f*x]*Sec[e + f*x])/f) - (Sqrt[a*Cos[e + f*x]^2]*Tan[e + f*x])/f

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 2670

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-f^(-1), Subst[Int[(1 - x^2
)^((m + n - 1)/2)/x^n, x], x, Cos[e + f*x]], x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n - 1)/2]

Rule 3255

Int[(u_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Int[ActivateTrig[u*(a*cos[e + f*x]^2)^p]
, x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a + b, 0]

Rule 3286

Int[(u_.)*((b_.)*sin[(e_.) + (f_.)*(x_)]^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Di
st[(b*ff^n)^IntPart[p]*((b*Sin[e + f*x]^n)^FracPart[p]/(Sin[e + f*x]/ff)^(n*FracPart[p])), Int[ActivateTrig[u]
*(Sin[e + f*x]/ff)^(n*p), x], x]] /; FreeQ[{b, e, f, n, p}, x] &&  !IntegerQ[p] && IntegerQ[n] && (EqQ[u, 1] |
| MatchQ[u, ((d_.)*(trig_)[e + f*x])^(m_.) /; FreeQ[{d, m}, x] && MemberQ[{sin, cos, tan, cot, sec, csc}, trig
]])

Rubi steps \begin{align*} \text {integral}& = \int \sqrt {a \cos ^2(e+f x)} \cot ^2(e+f x) \, dx \\ & = \left (\sqrt {a \cos ^2(e+f x)} \sec (e+f x)\right ) \int \cos (e+f x) \cot ^2(e+f x) \, dx \\ & = -\frac {\left (\sqrt {a \cos ^2(e+f x)} \sec (e+f x)\right ) \text {Subst}\left (\int \frac {1-x^2}{x^2} \, dx,x,-\sin (e+f x)\right )}{f} \\ & = -\frac {\left (\sqrt {a \cos ^2(e+f x)} \sec (e+f x)\right ) \text {Subst}\left (\int \left (-1+\frac {1}{x^2}\right ) \, dx,x,-\sin (e+f x)\right )}{f} \\ & = -\frac {\sqrt {a \cos ^2(e+f x)} \csc (e+f x) \sec (e+f x)}{f}-\frac {\sqrt {a \cos ^2(e+f x)} \tan (e+f x)}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 35, normalized size of antiderivative = 0.61 \[ \int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx=-\frac {\sqrt {a \cos ^2(e+f x)} \left (1+\csc ^2(e+f x)\right ) \tan (e+f x)}{f} \]

[In]

Integrate[Cot[e + f*x]^2*Sqrt[a - a*Sin[e + f*x]^2],x]

[Out]

-((Sqrt[a*Cos[e + f*x]^2]*(1 + Csc[e + f*x]^2)*Tan[e + f*x])/f)

Maple [A] (verified)

Time = 0.71 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.74

method result size
default \(\frac {\cos \left (f x +e \right ) a \left (\cos ^{2}\left (f x +e \right )-2\right )}{\sin \left (f x +e \right ) \sqrt {a \left (\cos ^{2}\left (f x +e \right )\right )}\, f}\) \(42\)
risch \(\frac {i \sqrt {\left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2} a \,{\mathrm e}^{-2 i \left (f x +e \right )}}\, \left ({\mathrm e}^{4 i \left (f x +e \right )}-6 \,{\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{2 \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}\) \(81\)

[In]

int(cot(f*x+e)^2*(a-a*sin(f*x+e)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

cos(f*x+e)*a*(cos(f*x+e)^2-2)/sin(f*x+e)/(a*cos(f*x+e)^2)^(1/2)/f

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.74 \[ \int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx=\frac {\sqrt {a \cos \left (f x + e\right )^{2}} {\left (\cos \left (f x + e\right )^{2} - 2\right )}}{f \cos \left (f x + e\right ) \sin \left (f x + e\right )} \]

[In]

integrate(cot(f*x+e)^2*(a-a*sin(f*x+e)^2)^(1/2),x, algorithm="fricas")

[Out]

sqrt(a*cos(f*x + e)^2)*(cos(f*x + e)^2 - 2)/(f*cos(f*x + e)*sin(f*x + e))

Sympy [F]

\[ \int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx=\int \sqrt {- a \left (\sin {\left (e + f x \right )} - 1\right ) \left (\sin {\left (e + f x \right )} + 1\right )} \cot ^{2}{\left (e + f x \right )}\, dx \]

[In]

integrate(cot(f*x+e)**2*(a-a*sin(f*x+e)**2)**(1/2),x)

[Out]

Integral(sqrt(-a*(sin(e + f*x) - 1)*(sin(e + f*x) + 1))*cot(e + f*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.34 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.74 \[ \int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx=-\frac {2 \, \sqrt {a} \tan \left (f x + e\right )^{2} + \sqrt {a}}{\sqrt {\tan \left (f x + e\right )^{2} + 1} f \tan \left (f x + e\right )} \]

[In]

integrate(cot(f*x+e)^2*(a-a*sin(f*x+e)^2)^(1/2),x, algorithm="maxima")

[Out]

-(2*sqrt(a)*tan(f*x + e)^2 + sqrt(a))/(sqrt(tan(f*x + e)^2 + 1)*f*tan(f*x + e))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1491 vs. \(2 (53) = 106\).

Time = 0.88 (sec) , antiderivative size = 1491, normalized size of antiderivative = 26.16 \[ \int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx=\text {Too large to display} \]

[In]

integrate(cot(f*x+e)^2*(a-a*sin(f*x+e)^2)^(1/2),x, algorithm="giac")

[Out]

-1/2*(sqrt(a)*sgn(tan(1/2*f*x)^4*tan(1/2*e)^4 - 4*tan(1/2*f*x)^3*tan(1/2*e)^3 - tan(1/2*f*x)^4 - 4*tan(1/2*f*x
)^3*tan(1/2*e) - 4*tan(1/2*f*x)*tan(1/2*e)^3 - tan(1/2*e)^4 - 4*tan(1/2*f*x)*tan(1/2*e)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*e)^3 - tan(1/2*
e)^4 - 4*tan(1/2*f*x)*tan(1/2*e) + 1)*tan(1/2*f*x)*tan(1/2*e)^2 - 12*sqrt(a)*sgn(tan(1/2*f*x)^4*tan(1/2*e)^4 -
 4*tan(1/2*f*x)^3*tan(1/2*e)^3 - tan(1/2*f*x)^4 - 4*tan(1/2*f*x)^3*tan(1/2*e) - 4*tan(1/2*f*x)*tan(1/2*e)^3 -
tan(1/2*e)^4 - 4*tan(1/2*f*x)*tan(1/2*e) + 1)*tan(1/2*e)^3 - sqrt(a)*sgn(tan(1/2*f*x)^4*tan(1/2*e)^4 - 4*tan(1
/2*f*x)^3*tan(1/2*e)^3 - tan(1/2*f*x)^4 - 4*tan(1/2*f*x)^3*tan(1/2*e) - 4*tan(1/2*f*x)*tan(1/2*e)^3 - tan(1/2*
e)^4 - 4*tan(1/2*f*x)*tan(1/2*e) + 1)*tan(1/2*f*x) - 2*sqrt(a)*sgn(tan(1/2*f*x)^4*tan(1/2*e)^4 - 4*tan(1/2*f*x
)^3*tan(1/2*e)^3 - tan(1/2*f*x)^4 - 4*tan(1/2*f*x)^3*tan(1/2*e) - 4*tan(1/2*f*x)*tan(1/2*e)^3 - tan(1/2*e)^4 -
 4*tan(1/2*f*x)*tan(1/2*e) + 1)*tan(1/2*e))/((tan(1/2*f*x)^4*tan(1/2*e) + tan(1/2*f*x)^3*tan(1/2*e)^2 - tan(1/
2*f*x)^3 + tan(1/2*f*x)*tan(1/2*e)^2 - tan(1/2*f*x) - tan(1/2*e))*(tan(1/2*e)^3 + tan(1/2*e))*f)

Mupad [B] (verification not implemented)

Time = 16.81 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.54 \[ \int \cot ^2(e+f x) \sqrt {a-a \sin ^2(e+f x)} \, dx=\frac {\sqrt {a-a\,{\left (\frac {{\mathrm {e}}^{-e\,1{}\mathrm {i}-f\,x\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2}-\frac {{\mathrm {e}}^{e\,1{}\mathrm {i}+f\,x\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2}\right )}^2}\,\left (-{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,6{}\mathrm {i}+{\mathrm {e}}^{e\,4{}\mathrm {i}+f\,x\,4{}\mathrm {i}}\,1{}\mathrm {i}+1{}\mathrm {i}\right )}{f\,\left ({\mathrm {e}}^{e\,4{}\mathrm {i}+f\,x\,4{}\mathrm {i}}-1\right )} \]

[In]

int(cot(e + f*x)^2*(a - a*sin(e + f*x)^2)^(1/2),x)

[Out]

((a - a*((exp(- e*1i - f*x*1i)*1i)/2 - (exp(e*1i + f*x*1i)*1i)/2)^2)^(1/2)*(exp(e*4i + f*x*4i)*1i - exp(e*2i +
 f*x*2i)*6i + 1i))/(f*(exp(e*4i + f*x*4i) - 1))